home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / SBDOS10.ARJ / INSTALL < prev    next >
Text File  |  1992-06-25  |  13KB  |  296 lines

  1.                Sound Blaster Pro(tm) BSD Unix device driver
  2.                           INSTALLATION NOTES
  3.                                  v1.4
  4.  
  5.                  Steve Haehnichen <shaehnic@ucsd.edu>
  6.  
  7.        $Id: INSTALL,v 1.3 1992/06/13 01:45:26 steve Exp steve $
  8.               [ This file is a part of SBlast-BSD-1.4 ]
  9.  
  10.   These notes are intended to help you install the driver into your 
  11.   386 BSD v4.3 kernel.  This document is still in Beta itself, so it's
  12.   not as complete as I would like it to be.  If you find any parts
  13.   especially confusing, please let me know so I can improve it in future
  14.   releases.
  15.  
  16. REQUIREMENTS:
  17. ------------
  18. The only system this driver has been tested on is Mt. Xinu's Mach386
  19. BSD v4.3.  I would expect any other BSD 386 system to be similar, but
  20. there are always differences.  This is the information I am looking
  21. for.  I am especially interested in the Free bootable BSD386 system
  22. released recently.  (Available via anonymous FTP to agate.berkeley.edu
  23. and many other archive sites.)
  24.  
  25. This package makes the blatant assumption that you are using the Gnu C
  26. Compiler, version 1.40 or later.  I have made no attempts to allow for
  27. compiler inadequacies, and leave a lot of speed optimizing to GCC.  In
  28. my experience, it is more productive to write explanatory code that
  29. works efficiently, and then let GCC optimize it far more than I could
  30. without obscuring it.  I highly recommend GCC v2.0 and the -O2 option.
  31. The performance increase is very noticeable.
  32.  
  33. Of course, a Sound Blaster is required.  Currently, this driver is
  34. pretty specific to the Sound Blaster Pro.  Minor modifications should
  35. allow it to work properly on the original Sound Blaster.  If you do
  36. not wish to make these changes, but want to run it on a Sound Blaster,
  37. you could try just using the features supported by the SB, and I would
  38. like to hear how it works out.  In future releases, there should be a
  39. flag to select Pro or not, and maybe just Adlib.  Pro Audio Spectrum
  40. 16 and Gravis Ultrasound adaptations are also something I would like
  41. to work on.
  42.  
  43.  
  44. ADDRESS SETTINGS:
  45. ----------------
  46. Before you install the driver, be very sure you know what your SB Pro
  47. jumper settings are.  The card defaults to DMA channel #1, I/O address
  48. 0x220, and IRQ 7.  You need to edit the SB driver to look for your
  49. card in the right place.
  50.  
  51. The DMA channel is probably best left at #1.  Consult the SB Pro
  52. installation guide if you think you might have a DMA conflict with
  53. other hardware in your machine.  Possible culprits are scanners and
  54. network interfaces.  If you change it from DMA channel #1, edit the
  55. first #define in sb_regs.h to reflect this.
  56.  
  57. The I/O port can be left at the default 0x220, but can be moved to
  58. 0x240 if it conflicts with something else.  Changes to the IO Port
  59. must be reflected in your autoconf.c file.  (See below)
  60.  
  61. Setting the IRQ (aka: Interrupt ReQuest, or PIC line) will require
  62. some thought.  The default setting is IRQ 7.  This is the same setting
  63. as standard parallel printer I/O cards. which generally works fine
  64. under DOS.  Under Unix, each device should have its own interrupt, so
  65. the default setting of 7 will not work.  In fact, the kernel will not
  66. boot if two devices share the same interrupt.  So, either change the
  67. interrupt on your printer card (not likely), or pick a different
  68. interrupt for the Sound Blaster (easier).
  69.  
  70. The IRQ jumper on the card has settings for IRQ 2, 5, 7, and 10.  Each
  71. of these has gotcha's, so you may have to experiment.
  72.  
  73. Interrupt #5 is generally unused in ISA bus machines, but Mach386 is
  74. configured to use it for the third RS-232 Serial port (com3 under
  75. DOS).  If you want to use this interrupt, you must edit autoconf.c and
  76. change the third com entry to have a different interrupt that is
  77. unused.  The line you want to change looks like this:
  78.  
  79.         {&comdriver, 2, -1, 0, 0,(caddr_t)0x3e8, SPLTTY, 5, 0, 0, comintrs,
  80.                                          (caddr_t) 0x3e8, 8, 0, 0, 0},
  81.  
  82. Change the 5 after SPLTTY to be something else, and then edit the SB
  83. entry to use IRQ 5, and you should be set.
  84.  
  85. IRQ 10 is almost certainly a safe bet because only 16-bit cards can
  86. use it.  The problem is that the original Sound Blaster didn't support
  87. IRQ 10, so some older SB software under DOS won't look for your sound
  88. card there.  This may be a problem if you still intend to run DOS
  89. games and such that support the original Sound Blaster.  Check out
  90. your favorite games and such before committing to this IRQ.
  91.  
  92. IRQ 2 is just confusing.  It is also probably the best choice.  If you
  93. are interested in understanding the whole issue, read on.  If you just
  94. want to get your card working, accept the fact that IRQ 2 on the bus
  95. is really IRQ 9 to Unix. Set your jumper to "IRQ 2", and configure the
  96. kernel (autoconf.c) to be IRQ 9.  You can Jump down to CONFIGURING.
  97.  
  98. Here's the full scoop: On a 16-bit bus, they decided to add more
  99. interrupts.  (The original 8-bit bus PCs had eight.)  To do this, they
  100. added another identical Parallel Interrupt Controller (PIC) chip,
  101. giving them eight more input lines.  The odd part is that the second
  102. PIC signals the first PIC chip when an interrupt comes in on the
  103. 16-bit side.  This interrupt signal is sent into IRQ 2 on the first
  104. PIC chip whenever an interrupt comes in on IRQ lines 9 through 15.
  105. This means that, in an AT, your cards can not really send an IRQ 2;
  106. only the second PIC can do that.  (This whole concept is suitably
  107. called "cascading" the PIC chips.)  Think about all this until it
  108. makes sense, and then go on.
  109.  
  110. To keep things compatible, the wire on the bus that used to be IRQ 2
  111. is not really connected to IRQ 2 on the first PIC chip anymore.  It
  112. can't be, because the second PIC chip needs that IRQ for itself.  Now,
  113. they decided to keep that line on the bus useful, and rewired it to be
  114. IRQ 9, which is the first interrupt line on the *second* PIC chip.
  115. So, the wire on the bus that used to be IRQ 2, is now really IRQ 9,
  116. and the real IRQ 2 is used by the second PIC chip.  The two chips give
  117. you a total of 16 lines, but since one is used by the second chip,
  118. there are only IRQ lines 1 through 15 available on the bus.
  119.  
  120. Now, in DOS, there is a vector table in memory to tell what to do
  121. about each interrupt.  DOS sets this up so that IRQ 9 does what IRQ 2
  122. would do on an 8-bit machine.  So, Creative Labs labeled the jumper
  123. IRQ 2 to keep from confusing people, and all the old DOS software will
  124. find the card when it looks at IRQ 2.  That's about it.
  125.  
  126. The moral of the story is that it's really IRQ 9 at the hardware
  127. level, and Unix requires that it be called by its true number, which
  128. is 9.  IRQ 2 is not available to kernel driver.  For this reason, set
  129. the jumper to "IRQ 2" and tell the kernel (define SB_IRQ down in
  130. autoconf.c) that the card is at IRQ 9.  And then just nod your head in
  131. understanding when DOS software says that it found your card at IRQ 2.
  132.  
  133.  
  134. CONFIGURING THE KERNEL:
  135. ----------------------
  136. If you have never recompiled your kernel before, you will certainly
  137. want to do this before even thinking about installing this driver.
  138. First work all the glitches out of a straight default build of the
  139. kernel, then start adding things.  If you have little experience at
  140. remaking your kernel, and get stuck, I will try to help.  Send Email,
  141. of course.
  142.  
  143. I am going to explain things as simply as I can.  If you are a Kernel
  144. Guru, please don't feel offended or anything, I just want to try to
  145. make it simple for as many people as possible.
  146.  
  147. After verifying that you can recompile the normal kernel and produce
  148. something usable, you will need to edit several configuration files.
  149. Diffs don't seem practical for this, so I have just included the
  150. necessary additions as they are.
  151.  
  152. I'm not sure how varied the specifics are among 386 BSD's, but if you
  153. get the general idea, hopefully you can figure out how to make things
  154. click on your system.  Of course, when you figure it out, send me mail
  155. so I can tell people how to put it on System X.  Here we go!
  156.  
  157.  
  158. ----- File src/conf/MASTER.i386.local:
  159.  
  160. This file selects which options get compiled into the kernel.
  161. The easiest thing to do is edit the line that looks like:
  162.  
  163. #  BINARY    = [debug mach gcc unix small MSTD nfs WS fp pseudomouse]
  164.  
  165. To make it look like:
  166.  
  167. #  BINARY    = [debug mach gcc unix small MSTD nfs WS fp pseudomouse sb]
  168.  
  169. This adds the Sound Blaster option to the BINARY configuration.
  170. Then add the device description itself to the end of this same file:
  171.  
  172. pseudo-device   sb              # <sb>
  173.  
  174. OK, Next file...
  175.  
  176.  
  177. ----- File src/conf/files.i386:
  178.  
  179. This tells which files are used for which devices.  You need to list
  180. the pathname of the Sound Blaster driver code.  If your sb_driver.c
  181. and supporting files are in the directory src/local, it would look
  182. like this:
  183.  
  184. local/sb_driver.c               optional sb device-driver
  185.  
  186. The end tags tell that it is an optional device driver given the short
  187. name "sb" for use elsewhere in configuration.
  188.  
  189.  
  190. ----- File src/i386at/conf.c:
  191.  
  192. Add the following code right in the middle of all the other redundant
  193. blocks that look a lot like it.  I put mine right before the "wt.h"
  194. driver.  Specific position doesn't matter, just in the area with all
  195. the rest.
  196.  
  197.  
  198. #include "sb.h"                 /* Sound Blaster */
  199. #if     NSB > 0
  200. int     sb_open (), sb_close (), sb_ioctl (), sb_read (), sb_write ();
  201. #else   NSB > 0
  202. #define sb_open         nulldev
  203. #define sb_close        nulldev
  204. #define sb_ioctl        nulldev
  205. #define sb_read         nulldev
  206. #define sb_write        nulldev
  207. #endif  NSB > 0
  208.  
  209.  
  210. Further down in the same file, there is a large array called cdevsw[].
  211. This contains all the functions to call for various system calls like
  212. open, close, read, write, ioctl, etc..
  213.  
  214. CMU has reserved all the major numbers up to 29, so you can make yours
  215. the next one.  The position in this array will be the major number you
  216. give to your devices when you 'mknod' them in /dev.  So, don't just
  217. slap it anywhere in the structure, but be sure to put it at the end.
  218. On my system, this means that the SB device will have major number 30.
  219. Remember this major number, you will need it for creating the entries
  220. in /dev.
  221.  
  222. Add these lines just within the closing brace of the cdevsw structure:
  223.  
  224.         sb_open,        sb_close,       sb_read,        sb_write,       /*30*/
  225.         sb_ioctl,       nodev,          nodev,          0,
  226.         seltrue,        nodev,
  227.  
  228.  
  229. ----- File src/i386at/autoconf.c:
  230.  
  231. Again, add this block in with all the others that look like it.  This
  232. tells the kernel what functions to call on an interrupt, and such.
  233.  
  234. #include <sb.h>                 /* Sound Blaster */
  235. #if NSB > 0
  236. extern struct isa_driver        sb_driver;
  237. extern int                      (*sb_intrs[])();
  238. #endif NSB
  239.  
  240. Also, you need to add this to the struct isa_dev Devsp[] declaration
  241. in autoconf.c.  Edit the IO_PORT and IRQ as necessary.  See the above
  242. section if you aren't sure what to use for the PORT, or IRQ values.
  243.  
  244. #if NSB > 0
  245. #define SB_IO_PORT 0x220
  246. #define SB_IRQ     9
  247.         {&sb_driver, 0, -1, 0, 0, (caddr_t)SB_IO_PORT, SPL1, SB_IRQ, 0, 0,
  248.            sb_intrs, (caddr_t)SB_IO_PORT, 24, 0, 0, 0},
  249. #endif NSB
  250.  
  251. Again, just slap that in with all the other similar structures.
  252.  
  253. -----
  254.  
  255. Ok, that's it for editing files.  Now install sb_driver.c and
  256. sb_regs.h into whatever directory you named earlier (like src/local),
  257. where the Makefile can find them.  Also, put sblast.h into
  258. /usr/include/i386at where everyone can get to it.  It has all the defs
  259. needed for user programs to use the device, and the driver itself
  260. looks for it there.
  261.  
  262. So, give it a whirl and see how far 'make' gets!
  263.  
  264. I hope it goes smoothly, but if it doesn't, send Email.
  265.  
  266. Once you have booted your new kernel, somewhere in the boot messages
  267. that fly by, it should say "Sound Blaster found" and list the I/O
  268. settings.  If you see this, then things are in order!
  269.  
  270. Now you have to make your device files.  First, edit the
  271. MAKEDEVS.sblast script to reflect the major number you got earlier.
  272. Set the variable "major" to be the right number.
  273. Become root and run the script to make all the device entries in /dev.
  274.  
  275. To test your new device, compile the programs in user_progs, and run
  276. "mixer" to look at the current settings.  If things look OK, try
  277. setting the DSP speed to, say 45454 (mono) by running
  278. $ cdsp 45454 -mono
  279.  
  280. If that works too, be daring and celebrate your new driver
  281. with something like this: 
  282.  
  283. $ cdsp 
  284. $ cat /vmunix >/dev/sb_dsp
  285.  
  286. If you hear the worst noise ever, Congratulations!
  287. Go get some unsigned-byte soundfiles and play away, or make your own with:
  288.  
  289. $ cat /dev/sb_dsp > soundfile
  290.  
  291. Good Luck & Happy Hacking!
  292. -Steve
  293.  
  294. Steve Haehnichen
  295. E-Mail: shaehnic@ucsd.edu
  296.